<style>
    table.table-form-title{margin:20px auto 0;}
    table.table-form-title td{text-align: center;border-bottom:0 !important;}
    table.table{width:90%;margin:0 auto;}
    table.table-form-attach{margin-bottom:100px;}
    .opinion-list li{margin-bottom:10px;}
    .opinion-list .line1,.opinion-list .line2{line-height:24px;}
    .opinion-list .author, .opinion-list .time{margin-right:10px;}
</style>
<div style="margin:0 auto;">
    <table class="table-form-title table" style="margin-top:20px;">
        <tr>
            <td colspan="4" style="border-bottom: 0 !important;">
                <h2>${config.getKey("COMPANY_NAME")}</h2>
                <h2>${bpmTaskFrom.fromName}</h2>
                <input type="hidden" name="processInstanceId" value="${bpmForm.processInstanceId}" />
            </td>
        </tr>
        <tr>
            <td width="15%"></td>
            <td width="45%"></td>
            <td width="15%"><span>发起时间：</span></td>
            <td class="text-left">
                <@f.input readonly=true value="${bpmForm.createTime?string('yyyy-MM-dd')}" name="createTime" type="date" dataType="date" dataFormat="yyyy-MM-dd"
                placeholder="请选择时间"  butClass="fa fa-calendar-plus-o" required=true />
            </td>
        </tr>
    </table>
    <table class="table-form-head table table-hover table-bordered">
        <tr>
            <th>项目档案编号</th>
            <td>
                <@f.input readonly=true value="${bpmForm.projectId}"  name="projectAdmin" placeholder="请输入项目经理" required=true/>
            </td>
            <th>项目经理</th>
            <td>
                <@f.input readonly=true value="${bpmForm.projectAdmin}"  name="projectAdmin" placeholder="请输入项目经理" required=true/>
            </td>
        </tr>
        <tr>
            <th>项目所属部门</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.projectDept}"  name="projectDept" placeholder="请输入项目所属部门" required=true/>
            </td>
        </tr>
        <tr>
            <th>项目名称</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.projectName}"name="projectName" placeholder="请输入项目名称" required=true/>
            </td>
        </tr>
        <tr>
            <th>委托单位</th>
            <td colspan="3">
                <@f.input readonly=true value="${bpmForm.clientCompany}" name="clientCompany" placeholder="请输入委托单位" required=true/>
            </td>
        </tr>
        <tr>
            <th>是否中标</th>
            <td>
                ${dict.getLabel('sys_yes_no', bpmForm.isBided)}
            </td>
            <th>中标金额(元)</th>
            <td>
                <@f.input readonly=true name="bidedAmount" value="${bpmForm.bidedAmount}" placeholder="请输入中标金额" required=true/>
            </td>
        </tr>
        <tr>
            <th>投标保证金来源</th>
            <td>
                <@f.select readonly=true name="depositFrom" dictType="bid_deposit_from" blankValue="${bpmForm.depositFrom}" blankLabel="${dict.getLabel('bid_deposit_from', bpmForm.depositFrom)}"/>
            </td>
            <th>投标保证金金额</th>
            <td>
                <@f.input readonly=true name="depositAmount" value="${bpmForm.depositAmount}" placeholder="请输入投标保证金金额" required=true/>
            </td>
        </tr>
        <tr>
            <th>上传中标通知书</th>
            <td colspan="3">
                <input type="hidden" name="bidedNoticeUrl" value="" />
                <div class="pull-left"></div>
                <div class="pull-right"><a href="#"><i class="fa icon-link"></i></a></div>
            </td>
        </tr>
        <tr>
            <th>处理意见</th>
            <td colspan="3">
                <ul class="opinion-list">
                    <#list comment as vo>
                    <li>
                        <div class="line1">【${vo.typeName}】${vo.message}</div>
                        <div class="line2"><span class="author">${vo.userName}</span><span class="time">${vo.time?string("YY-MM-dd HH:mm:ss")}</span></div>
                    </li>
                </#list>
                </ul>
            </td>
        </tr>
        <tr>
            <th>备注</th>
            <td colspan="3">
                <@f.input readonly=true name="remark" value="${bpmForm.remark}" placeholder="请输入备注" required=true/>
            </td>
        </tr>
    </table>

</div>
<script type="text/javascript">

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "projectId"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            console.log(data)
            console.log(data.department);
            console.log(data.ceoName);
            $("input[name=projectDept]").val(data.department);
            $("input[name=projectName]").val(data.projectName);
            $("input[name=projectAdmin]").val(data.ceoName);
            $("input[name=clientCompany]").val(data.contractFirst);
        }
    }


    $("button[name=btn-insert]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length + 1;
        var tpl = $(target.children().get(0)).prop("outerHTML");
        tpl = tpl.replaceAll("1", index);
        target.append(tpl);
    });
    $("button[name=btn-del]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        if(index>0){
            target.children().get(index).remove();
        }
    });
    $("button[name=btn-del-all]").click(function () {
        var target = $(this).closest("table").find("tbody");
        var index = target.children().length - 1;
        for(var i=index; i>0; i--){
            target.children().get(i).remove();
        }
    });
</script>